<?php

namespace App\Http\Requests\Admin\Customer\HairAsset;

use App\Http\Requests\ApiRequest;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class HairAssetStoreRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'asset_title'  => 'required|string|max:'.self::MAX_STRING,
            'sort'         => 'required|int|between:0,10000',
            'hair_preview' => 'required|file|max:2048',
            'assets_dir'   => ['required', 'string', 'max:'.self::MAX_STRING, Rule::unique('hair_assets', 'assets_dir')],
            'assets_bin'   => 'required|file|mimes:bin',
            'assets_png'   => 'required|file|mimes:png',
            'gender'       => 'required|int|in:0,1,2',
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'asset_title.*'    => '素材标题必须',
//            'sort.*'         => '排序优先级必须是数值',
//            'hair_preview.*' => '发型预览图必须是上传的图片',
//            'assets_dir.*'   => '存放2.5d素材的bos目录必须是唯一的字符串',
//            'assets_bin.*'   => '素材文件必须是上传的.bin文件',
//            'assets_png.*'   => '素材图片必须是上传的png图片',
//            'gender.*'       => '性别必须是0或1或2',
//        ];
//    }
}
